package com.hanoi.wiki.model.json;

import java.io.Serializable;
import java.util.Date;

import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.hanoi.wiki.common.DateSerializer;
import com.hanoi.wiki.model.Log;
import com.hanoi.wiki.model.Places;
import com.hanoi.wiki.model.PlacesInQueued;

public class LogJson extends BaseJsonObject implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private int id;
	private Date updatedTime;
	private String detail;
	private int places;
	private int placesInQueued;

	public LogJson() {

	}

	public LogJson(Log log) {
		if(log != null) {
			this.id = log.getId();
			this.updatedTime = log.getUpdatedTime();
			this.detail = log.getDetail();
			
			Places place = log.getPlaces();
			if(place != null) {
				this.places = place.getId();
			}
			
			PlacesInQueued inQueued = log.getPlacesInQueued();
			if(inQueued != null) {
				this.placesInQueued = inQueued.getId();
			}	
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}
	
	@JsonSerialize(using=DateSerializer.class)
	public Date getUpdatedTime() {
		return updatedTime;
	}

	public void setUpdatedTime(Date updatedTime) {
		this.updatedTime = updatedTime;
	}

	public String getDetail() {
		return detail;
	}

	public void setDetail(String detail) {
		this.detail = detail;
	}

	public int getPlaces() {
		return places;
	}

	public void setPlaces(int places) {
		this.places = places;
	}

	public int getPlacesInQueued() {
		return placesInQueued;
	}

	public void setPlacesInQueued(int placesInQueued) {
		this.placesInQueued = placesInQueued;
	}
	
	
}
